<!DOCTYPE html>
<html lang="cn">
<head>
    <meta charset="UTF-8">
    <title>获得元素</title>
</head>
<body>
<button id="btn1">1</button>
<button class="btn2">2</button>
<button name="btn3">3</button>
<button>4</button>
<button>5</button>
<script type="text/javascript">
    var btn1= document.getElementById('btn1');
    console.log(btn1.innerHTML);
    btn1.innerHTML="一";
    
    var btn2=document.getElementsByClassName("btn2")[0];
    console.log(btn2);
    
    var btn3=document.getElementsByName("btn3")[0];
    console.log(btn3);
    
    var btn4=document.querySelectorAll("button")[3];
    console.log(btn4);
    
    var btn5=document.getElementsByTagName("button")[4]
    console.log(btn5);
</script>
<label for="text"></label><input type="text" id="text" value="123">
<script>
    console.log(document.getElementById("text").value)
</script>
</body>
</html>